/**
 * 
 */
package GUI;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;

import java.awt.Font;
import java.awt.Color;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JScrollPane;

/**
 * @author aviat
 *
 */
public class AddCustomer extends JPanel{

	
	private static final long serialVersionUID = 1L;
	private JTextField gFnameTextField;
	private JTextField gLnameTextField;
	private JTextField bFnameTextField;
	private JTextField bLnameTextField;
	private JTextField gPhoneTextField;
	private JTextField bPhoneTextField;
	private JTextField emailTextField;
	private JTextField addressTextField;
	private JButton btnBack;
	private JButton btnAdd;
	private JLabel iconlabel;
	private JScrollPane scrollPane;
	private JTextField CustomerIDtextField;

	/**
	 * Constructor
	 */
	public AddCustomer() {
		setLayout(null);
		
		bFnameTextField = new JTextField();
		bLnameTextField = new JTextField();
		gPhoneTextField = new JTextField();
		gPhoneTextField.addKeyListener(new KeyAdapter() {
			public void keyTyped(KeyEvent evt) {
				char c = evt.getKeyChar();
				if(!(Character.isDigit(c) || (c==KeyEvent.VK_BACK_SPACE) || (c==KeyEvent.VK_DELETE))){
					getToolkit().beep();
					evt.consume();
				}
			}
		});
		gFnameTextField = new JTextField();
		bPhoneTextField = new JTextField();
		bPhoneTextField.addKeyListener(new KeyAdapter() {
			public void keyTyped(KeyEvent evt) {
				char c = evt.getKeyChar();
				if(!(Character.isDigit(c) || (c==KeyEvent.VK_BACK_SPACE) || (c==KeyEvent.VK_DELETE))){
					getToolkit().beep();
					evt.consume();
				}
			}
		});
		emailTextField = new JTextField();
		gLnameTextField = new JTextField();
		btnBack = new JButton("Back");
		btnBack.setIcon(new ImageIcon(AddCustomer.class.getResource("/resources/back22.png")));
		CustomerIDtextField = new JTextField();
		
		initialize();
	}

	private void initialize() {
		JLabel lblAddCustomer = new JLabel("Add Customer");
		lblAddCustomer.setForeground(new Color(0, 204, 255));
		lblAddCustomer.setFont(new Font("Tahoma", Font.BOLD, 16));
		lblAddCustomer.setBounds(10, 11, 143, 25);
		add(lblAddCustomer);
		
		JLabel lblGName = new JLabel("Groom First Name:");
		lblGName.setForeground(Color.WHITE);
		lblGName.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblGName.setBounds(20, 108, 133, 17);
		add(lblGName);
		
		
		gFnameTextField.setBounds(170, 106, 117, 27);
		add(gFnameTextField);
		gFnameTextField.setColumns(10);
		
		JLabel lblBName = new JLabel("Groom Last Name:");
		lblBName.setForeground(Color.WHITE);
		lblBName.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblBName.setBounds(20, 166, 133, 14);
		add(lblBName);
		
		
		gLnameTextField.setBounds(170, 166, 117, 27);
		add(gLnameTextField);
		gLnameTextField.setColumns(10);
		
		JLabel lblNewLabel = new JLabel("Bride First Name:");
		lblNewLabel.setForeground(Color.WHITE);
		lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblNewLabel.setBounds(20, 225, 133, 20);
		add(lblNewLabel);
		
		JLabel lblBLastName = new JLabel("Bride Last Name:");
		lblBLastName.setForeground(Color.WHITE);
		lblBLastName.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblBLastName.setBounds(20, 292, 133, 17);
		add(lblBLastName);
		
		JLabel lblGPhoneNumber = new JLabel("Groom Phone Number:\r\n");
		lblGPhoneNumber.setForeground(Color.WHITE);
		lblGPhoneNumber.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblGPhoneNumber.setBounds(358, 108, 145, 17);
		add(lblGPhoneNumber);
		
		JLabel lblBPhoneNumber = new JLabel("Bride Phone Number:");
		lblBPhoneNumber.setForeground(Color.WHITE);
		lblBPhoneNumber.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblBPhoneNumber.setBounds(358, 165, 145, 17);
		add(lblBPhoneNumber);
		
		JLabel lblEMail = new JLabel("Email:");
		lblEMail.setForeground(Color.WHITE);
		lblEMail.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblEMail.setBounds(358, 228, 145, 14);
		add(lblEMail);
		
		JLabel lblAddress = new JLabel("Address:");
		lblAddress.setForeground(Color.WHITE);
		lblAddress.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblAddress.setBounds(358, 293, 145, 14);
		add(lblAddress);
		
//		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
//		 dataset.setValue(6, "Profit", "Jane");
//		 dataset.setValue(7, "Profit", "Tom");
//		 dataset.setValue(8, "Profit", "Jill");
//		 dataset.setValue(5, "Profit", "John");
//		 dataset.setValue(12, "Profit", "Fred");
//		 JFreeChart chart = ChartFactory.createBarChart3D("Comparison between Salesman", 
//		 "Salesman", "Profit", dataset, PlotOrientation.VERTICAL, 
//		 false, true, false);
//
//		ChartPanel chartPanel = new ChartPanel(chart);
//
//		//and then wherever you want to add it to (X) use
//		add(chartPanel);
		

		
		bFnameTextField.setBounds(170, 225, 117, 27);
		add(bFnameTextField);
		bFnameTextField.setColumns(10);
		
		bLnameTextField.setColumns(10);
		bLnameTextField.setBounds(170, 290, 117, 27);
		add(bLnameTextField);
		
		gPhoneTextField.setColumns(10);
		gPhoneTextField.setBounds(513, 105, 117, 27);
		add(gPhoneTextField);
		
		bPhoneTextField.setColumns(10);
		bPhoneTextField.setBounds(513, 162, 117, 27);
		add(bPhoneTextField);
		
		emailTextField.setColumns(10);
		emailTextField.setBounds(513, 224, 183, 27);
		add(emailTextField);
		
		scrollPane = new JScrollPane();
		scrollPane.setBounds(513, 289, 183, 66);
		add(scrollPane);
		addressTextField = new JTextField();
		scrollPane.setViewportView(addressTextField);
		
		addressTextField.setColumns(10);
		
		btnBack.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnBack.setBounds(10, 462, 101, 27);
		add(btnBack);
		
		ImageIcon LOGOImageIcon = new ImageIcon(getClass().getClassLoader().getResource("resources/camera-background3.png"));
		ImageIcon LOGO = new ImageIcon (LOGOImageIcon.getImage().getScaledInstance(-1, -1, java.awt.Image.SCALE_SMOOTH));
		btnAdd = new JButton("Add");
		btnAdd.setIcon(new ImageIcon(AddCustomer.class.getResource("/resources/edit_add.png")));
		
		btnAdd.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnAdd.setBounds(323, 417, 101, 27);
		add(btnAdd);
		
	
		/*JButton btnTest = new JButton("Test");
		btnTest.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				DefaultPieDataset pieDataset = new DefaultPieDataset();
				pieDataset.setValue("January", new Integer(10));
				pieDataset.setValue("February", new Integer(20));
				pieDataset.setValue("March", new Integer(30));
				pieDataset.setValue("April", new Integer(40));
				JFreeChart chart = ChartFactory.createPieChart("test pie chart", pieDataset, true, true, true);
				PiePlot p = (PiePlot) chart.getPlot();
				ChartFrame frame = new ChartFrame("test pie chart",chart);
				frame.setVisible(true);
				frame.setSize(450, 500);
			}
		});*/
		
		JLabel lblCustomerId = new JLabel("Customer ID");
		lblCustomerId.setForeground(Color.WHITE);
		lblCustomerId.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblCustomerId.setBounds(20, 351, 91, 27);
		add(lblCustomerId);
		
		
		CustomerIDtextField.setBounds(170, 352, 117, 27);
		add(CustomerIDtextField);
		CustomerIDtextField.setColumns(10);
		//	btnTest.setBounds(250, 51, 89, 23);
		//	add(btnTest);
			
			iconlabel = new JLabel("");
			iconlabel.setIcon(LOGO);
			iconlabel.setBounds(0, 0, 786, 500);
			add(iconlabel);
	}

	/**
	 * @return the gFnameTextField
	 */
	public JTextField getgFnameTextField() {
		return gFnameTextField;
	}

	/**
	 * @param gFnameTextField the gFnameTextField to set
	 */
	public void setgFnameTextField(JTextField gFnameTextField) {
		this.gFnameTextField = gFnameTextField;
	}

	/**
	 * @return the gLnameTextField
	 */
	public JTextField getgLnameTextField() {
		return gLnameTextField;
	}

	/**
	 * @param gLnameTextField the gLnameTextField to set
	 */
	public void setgLnameTextField(JTextField gLnameTextField) {
		this.gLnameTextField = gLnameTextField;
	}

	/**
	 * @return the bFnameTextField
	 */
	public JTextField getbFnameTextField() {
		return bFnameTextField;
	}

	/**
	 * @param bFnameTextField the bFnameTextField to set
	 */
	public void setbFnameTextField(JTextField bFnameTextField) {
		this.bFnameTextField = bFnameTextField;
	}

	/**
	 * @return the bLnameTextField
	 */
	public JTextField getbLnameTextField() {
		return bLnameTextField;
	}

	/**
	 * @param bLnameTextField the bLnameTextField to set
	 */
	public void setbLnameTextField(JTextField bLnameTextField) {
		this.bLnameTextField = bLnameTextField;
	}

	/**
	 * @return the gPhoneTextField
	 */
	public JTextField getgPhoneTextField() {
		return gPhoneTextField;
	}

	/**
	 * @param gPhoneTextField the gPhoneTextField to set
	 */
	public void setgPhoneTextField(JTextField gPhoneTextField) {
		this.gPhoneTextField = gPhoneTextField;
	}

	/**
	 * @return the bPhoneTextField
	 */
	public JTextField getbPhoneTextField() {
		return bPhoneTextField;
	}

	/**
	 * @param bPhoneTextField the bPhoneTextField to set
	 */
	public void setbPhoneTextField(JTextField bPhoneTextField) {
		this.bPhoneTextField = bPhoneTextField;
	}

	/**
	 * @return the emailTextField
	 */
	public JTextField getEmailTextField() {
		return emailTextField;
	}

	/**
	 * @param emailTextField the emailTextField to set
	 */
	public void setEmailTextField(JTextField emailTextField) {
		this.emailTextField = emailTextField;
	}

	/**
	 * @return the addressTextField
	 */
	public JTextField getAddressTextField() {
		return addressTextField;
	}

	/**
	 * @param addressTextField the addressTextField to set
	 */
	public void setAddressTextField(JTextField addressTextField) {
		this.addressTextField = addressTextField;
	}

	/**
	 * @return the btnBack
	 */
	public JButton getBtnBack() {
		return btnBack;
	}

	/**
	 * @return the btnAdd
	 */
	public JButton getBtnAdd() {
		return btnAdd;
	}

	/**
	 * @return the customerIDtextField
	 */
	public JTextField getCustomerIDtextField() {
		return CustomerIDtextField;
	}

	/**
	 * @param customerIDtextField the customerIDtextField to set
	 */
	public void setCustomerIDtextField(JTextField customerIDtextField) {
		CustomerIDtextField = customerIDtextField;
	}

	/**
	 * @param btnBack the btnBack to set
	 */
	public void setBtnBack(JButton btnBack) {
		this.btnBack = btnBack;
	}

	/**
	 * @param btnAdd the btnAdd to set
	 */
	public void setBtnAdd(JButton btnAdd) {
		this.btnAdd = btnAdd;
	}
}
